<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix='sec' uri='http://www.springframework.org/security/tags' %>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@page import="com.gosophia.commons.web.bean.RequestResult"%>
<%@page import="com.gosophia.springsecurity.UserDetailsImpl"%>
<%@page import="org.springframework.security.context.SecurityContextHolder"%>
<%
	String path = request.getContextPath();
	Object viewObj = request.getParameter("view");
	if(viewObj != null)
		request.setAttribute("view", (String) viewObj);
	UserDetailsImpl userDetailsImpl = ((UserDetailsImpl)SecurityContextHolder.getContext().getAuthentication().getPrincipal());
	request.setAttribute("mergePermissionDTOs", userDetailsImpl.getUserAccountDTO().getMergePermissionDTOs());
%>

<div class="left mp-left-auto-height">
	<div id="quickLauncher">
		<a id="goSchedule">
			<span>日程</span>
		</a>
		<a id="goAccount">
			<span>联系人</span>
		</a>
		<a id="goWiki">
			<span>知识库</span>
		</a>
	</div>
	<div>
		<ul id="menu">
			<s:iterator value="#request.mergePermissionDTOs" status="first_status" id="mergePermissionDTO">
					<s:if test="#mergePermissionDTO.permissionStatus == 1 && #mergePermissionDTO.childPermissionDTOs.size > 0">
						<li class="l1">
						<a href="javascript: void(0);" class="has-children switch-l2" id="main_menu_${mergePermissionDTO.permissionId }">
						    <s:property value="#mergePermissionDTO.permissionName"/>
						</a>
						<div class="menu-l2" style="display: none;">
							<ul class="l2-entity">
							  	<s:iterator value="#mergePermissionDTO.childPermissionDTOs" status="sec_status" id="child">
							        <s:if test="#child.permissionStatus == 1">
							        <li class="l2" id="child_menu_${mergePermissionDTO.permissionId }_${child.permissionId }">
										<span></span>
										<a href="<%=path %>${child.menuLink}" id="menu_${mergePermissionDTO.permissionId }_${child.permissionId }"><s:property value="#child.permissionName"/></a>
									</li>
									</s:if>
								</s:iterator>
							</ul>
						</div>
						</li>
					</s:if>
					<s:elseif test="#mergePermissionDTO.permissionStatus == 1">
						<li class="l1">
						<a href="javascript: void(0);" class="switch-l2" id="main_menu_${mergePermissionDTO.permissionId }">
						    <s:property value="#mergePermissionDTO.permissionName"/>
						</a>
						</li>
					</s:elseif>
			</s:iterator>
		</ul>
	</div>
</div>
<script type="text/javascript">
	var _view = "${view}";
	var _menuTag = _view.split("-");
	$("#main_menu_" + _menuTag[0]).addClass("main-menu-open").next("div").show();
	$("#child_menu_" + _menuTag[0] + "_" + _menuTag[1]).addClass("child-menu-selected");
	$("#child_menu_" + _menuTag[0] + "_" + _menuTag[1] + "_" +  _menuTag[2]).addClass("child-menu-selected-a");
</script>